/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.rational.sheet.table.row;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JList;
import javax.swing.JTable;

    
/**
 *
 * @author Overmind
 */
public class RowHeaderMouseAdapter
    extends MouseAdapter
{
    private JTable table = null;
    private JList list = null;
    
    public RowHeaderMouseAdapter(JTable table, JList list)
    {
	this.table = table;
	this.list = list;
	
    }
    
    @Override
    public void mouseClicked(MouseEvent me)
    {
	super.mouseClicked(me);

	int index = list.locationToIndex(me.getPoint());
	
	if(index >= 0)
	{
	    table.setRowSelectionInterval(index, index);
	    table.setColumnSelectionInterval(0, table.getColumnCount() - 1);
	}
    }

    @Override
    public void mouseEntered(MouseEvent me)
    {
	super.mouseEntered(me); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void mouseExited(MouseEvent me)
    {
	super.mouseExited(me); //To change body of generated methods, choose Tools | Templates.
    }
    
    
}
